Class Pager

Summary

Fully Qualified Name: CodeIgniter\Pager\Pager
Implements: PagerInterface

Description

Class Pager

The Pager class provides semi-automatic and manual methods for creating pagination links and reading the current url's query variable, "page" to determine the current page. This class can support multiple paginations on a single page.

Methods

Name Description Defined By
__construct() Constructor. Pager
getCurrentPage() Returns the number of the current page of results. Pager
getDetails() Returns an array with details about the results, including total, per_page, current_page, last_page, next_url, prev_url, from, to. Pager
getFirstPage() Determines the first page # that should be shown. Pager
getLastPage() Returns the last page, if we have a total that we can calculate with. Pager
getNextPageURI() Returns the full URI to the next page of results, or null. Pager
getPageCount() Returns the total number of pages. Pager
getPageURI() Returns the URI for a specific page for the specified group. Pager
getPerPage() Returns the number of results per page that should be shown. Pager
getPreviousPageURI() Returns the full URL to the previous page of results, or null. Pager
hasMore() Tells whether this group of results has any more pages of results. Pager
links() Handles creating and displaying the Pager
makeLinks() Allows for a simple, manual, form of pagination where all of the data is provided by the user. The URL is the current URI. Pager
only() Sets only allowed queries on pagination links. Pager
setPath() Sets the path that an aliased group of links will use. Pager
simpleLinks() Creates simple Next/Previous links, instead of full pagination. Pager
store() Stores a set of pagination data for later display. Most commonly used by the model to automate the process. Pager

Method Details

__construct()

Constructor.

Parameter Name Type Description
$config \type
$view \RendererInterface

Returns:

getCurrentPage()

Returns the number of the current page of results.

Parameter Name Type Description
$group string|null

Returns: int

getDetails()

Returns an array with details about the results, including total, per_page, current_page, last_page, next_url, prev_url, from, to.

Does not include the actual data. This data is suitable for adding a 'data' object to with the result set and converting to JSON.

Parameter Name Type Description
$group string

Returns: array

getFirstPage()

Determines the first page # that should be shown.

Parameter Name Type Description
$group string

Returns: int

getLastPage()

Returns the last page, if we have a total that we can calculate with.

Parameter Name Type Description
$group string

Returns: int|null

getNextPageURI()

Returns the full URI to the next page of results, or null.

Parameter Name Type Description
$group string
$returnObject bool

Returns: string|null

getPageCount()

Returns the total number of pages.

Parameter Name Type Description
$group string|null

Returns: int

getPageURI()

Returns the URI for a specific page for the specified group.

Parameter Name Type Description
$page int|null
$group string
$returnObject bool

Returns: string|\CodeIgniter\HTTP\URI

getPerPage()

Returns the number of results per page that should be shown.

Parameter Name Type Description
$group string

Returns: int

getPreviousPageURI()

Returns the full URL to the previous page of results, or null.

Parameter Name Type Description
$group string
$returnObject bool

Returns: string|null

hasMore()

Tells whether this group of results has any more pages of results.

Parameter Name Type Description
$group string|null

Returns: bool

links()

Handles creating and displaying the

Parameter Name Type Description
$group string
$template string The

Returns: string

makeLinks()

Allows for a simple, manual, form of pagination where all of the data is provided by the user. The URL is the current URI.

Parameter Name Type Description
$page int
$perPage int
$total int
$template string The
$segment int (if
$group string optional

Returns: string

only()

Sets only allowed queries on pagination links.

Parameter Name Type Description
$queries array

Returns: \Pager

setPath()

Sets the path that an aliased group of links will use.

Parameter Name Type Description
$path string
$group string

Returns: mixed

simpleLinks()

Creates simple Next/Previous links, instead of full pagination.

Parameter Name Type Description
$group string
$template string

Returns: string

store()

Stores a set of pagination data for later display. Most commonly used by the model to automate the process.

Parameter Name Type Description
$group string
$page int
$perPage int
$total int
$segment int

Returns: $this

Top